<?php
namespace app\index\model;
use think\Model;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/22
 * Time: 16:04
 */
class Car extends Model
{
    protected $table = 'boc_car';
    protected $connection = 'JXC';
    public function getsum($where){
        $data=Car::where($where)->sum('num*price');
        return $data;
    }
    public function getlist($where){
        $data=Car::where($where)->order('id', 'desc')->select();
        return $data;
    }
    public function getone($where){
        $data=Car::where($where)->find();
        return $data;
    }
    public function allcar($where){
        $data=Car::where($where)->all();
        return $data;
    }
    public function updatecar($updates,$where){
        $data=Car::save($updates,$where);
        return $data;
    }
    public function emptycar($where){
        $data=Car::where($where)->delete();
        return $data;
    }
    public function add($data){
        $data=Car::insertGetId($data);
        return $data;
    }
}